home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / MATH / FSULTRA1.ZIP / ULTRA_TP.ASM < prev    next >
Assembly Source File  |  1992-06-18  |  3KB  |  143 lines

  1. comment ! 
  2. FSU - ULTRA    The greatest random number generator that ever was
  3.         or ever will be.  Way beyond Super-Duper.
  4.         (Just kidding, but we think its a good one.)
  5.  
  6. Authors:    Arif Zaman (arif@stat.fsu.edu) and
  7.         George Marsaglia (geo@stat.fsu.edu).
  8.  
  9. Date:        27 May 1992
  10.  
  11. Version:    1.05
  12.  
  13. Copyright:    To obtain permission to incorporate this program into
  14.         any commercial product, please contact the authors at
  15.         the e-mail address given above or at
  16.  
  17.         Department of Statistics and
  18.         Supercomputer Computations Research Institute
  19.         Florida State University
  20.         Tallahassee, FL 32306.
  21.  
  22. See Also:    README        for a brief description
  23.         ULTRA.DOC    for a detailed description
  24.  
  25. -----------------------------------------------------------------------
  26. ;
  27. ; File:  ULTRA_TP.ASM (Turbo Pascal calling conventions)
  28. ;
  29. DOSSEG
  30. .MODEL TPASCAL
  31.  
  32. ;===== B: GLOBAL FUNCTIONS, SUBROUTINES and VARIABLES =================
  33. ;
  34.     public  i31bit, i15bit, i7bit,  i1bit,  uni,    duni
  35.     public  i32bit, i16bit, i8bit,  rinit,  vni,    dvni
  36.  
  37. ;===== D. MACRO DEFINITIONS ===========================================
  38. ;
  39. ; RinitProcStart should take two 32-bit arguments conx and shrx
  40. ;   and place them in the data segment in congx and shrgx.
  41. ;   es and ds should both point to the data segment.
  42. ;   conx must be odd (so we or with 1 just to make sure).
  43. ; FillProc
  44. ;   DS is already the data segment. ES should also be made the same.
  45.  
  46. EnterProcedure   macro
  47. endm
  48.  
  49. ExitProcedure    macro
  50.     ret
  51. endm
  52.  
  53. Enter2arg   macro
  54.   arg conx:dword, shrx:dword
  55.   EnterProcedure
  56.     mov ax,ds
  57.     mov es,ax
  58.     mov ax,word ptr conx
  59.     shl ax,1
  60.     mov conglo,ax
  61.     mov ax,word ptr conx+2
  62.     rcl ax,1
  63.     mov conghi,ax
  64.     or  byte ptr conglo,1
  65.     mov ax,word ptr shrx
  66.     mov shrglo,ax
  67.     mov ax,word ptr shrx+2
  68.     mov shrghi,ax
  69. endm
  70.  
  71. Exit2arg     macro
  72.   ExitProcedure
  73. endm
  74.  
  75. EnterFill    macro
  76.     mov    ax,ds
  77.     mov    es,ax
  78. endm
  79.  
  80. ExitFill    macro
  81.     ret
  82. endm
  83.  
  84. DwordFn macro
  85. endm
  86.  
  87. WordFn  macro
  88. endm
  89.  
  90. ByteFn  macro
  91. endm
  92.  
  93. RealFn  macro
  94. endm
  95.  
  96. DoubleFn macro
  97. endm
  98.  
  99. ;===== DATA ========================================================
  100.  
  101.   N equ 37              ; The number of 32 bit words in the table
  102.   N2 equ 24             ;  x(i) = x(i-N) - x(i-N2)
  103.  
  104. counterpoint    STRUC
  105.   c  dw 0               ; counter
  106.   p  dw ?               ; offset for pointer
  107.      dw ?               ; segment for pointer
  108.   x  dd N dup (?)    ; data
  109. ENDS
  110.  
  111.   extrn swbstate            ; In TP, the shared DATA is
  112.   cps = size counterpoint
  113.   cp1 = cps - 4*N + 32
  114.   swb32 = counterpoint ptr swbstate    ; in the TPU, so we define a
  115.   swb16 = counterpoint ptr swb32+cps    ; large array there, and refer
  116.   swb8  = counterpoint ptr swb16+cps    ; to it here. This ensures that
  117.   swb1  = counterpoint ptr swb8 +cps    ; the swbstate is contiguous.
  118.   swbseed = dword ptr swb1     + cp1
  119.   flags   = byte  ptr swbseed  + 4*N
  120.   congx   = dword ptr flags    + 1
  121.  
  122.   extrn tmpq  : qword
  123.   extrn neg31 : word
  124.   extrn neg63 : word
  125.  
  126.   conglo  equ word ptr congx
  127.   conghi  equ word ptr congx+2
  128.   tmpw1   equ word ptr tmpq
  129.   tmpw2   equ word ptr tmpq+2
  130.   tmpw3   equ word ptr tmpq+4
  131.   tmpw4   equ word ptr tmpq+6
  132.   tmpdlo  equ dword ptr tmpq
  133.   tmpdhi  equ dword ptr tmpq+4
  134.   shrglo  equ tmpw1
  135.   shrghi  equ tmpw2
  136.   shrgx   equ tmpdlo
  137.  
  138. .CODE
  139.   INCLUDE ULTRACOD.INC
  140. END
  141.  
  142.